﻿using System.Drawing;
using System.IO;
using PlanningGIS.DataConvert.form;
using ESRI.ArcGIS.ADF.BaseClasses;
using System.Resources;
using PlanningGIS.Framework;

namespace PlanningGIS.DataConvert.button
{
    /// <summary>
    /// 导出dwg
    /// </summary>
    public class btnExportDwg : BaseCommand
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public btnExportDwg()
        {
            base.m_caption = "由库出图";
            base.m_toolTip = base.m_caption;
        }

        /// <summary>
        /// 
        /// </summary>
        FrmExportDwg frm = null;

        /// <summary>
        /// 
        /// </summary>
        IApplication m_Application = null;

        /// <summary>
        /// 创建图标
        /// </summary>
        /// <param name="hook"></param>
        public override void OnCreate(object hook)
        {
            if (m_Application == null)
            {
                m_Application = hook as IApplication;
            }            
        }

        /// <summary>
        /// 是否可用
        /// </summary>
        public override bool Enabled
        {
            get
            {
                return true;
            }
        }

        /// <summary>
        /// 点击事件
        /// </summary>
        public override void OnClick()
        {
            if (m_Application == null) return;
            if (frm == null || frm.IsDisposed)
            {
                frm = new FrmExportDwg();
                frm.Hook = (m_Application as IFramework).Object;
                frm.Show((m_Application as IFramework).MdiForm);
            }
            else
            {
                frm.BringToFront();
            }
        }

    }
}
